package com.gildedrose.item;

import com.gildedrose.vo.Quality;

public abstract class ItemAdapter extends Item {
    public ItemAdapter(String name, int sellIn, Quality quality) {
        super(name, sellIn, quality.getValue());
    }

    public void updateSellIn() {
        sellIn -= 1;
    }

    public void updateQuality() {
        if (quality > 0) {
            quality = quality - 1;
        }
    }

    // 一旦销售期限过期，品质`Quality`会以双倍速度加速下降
    public void updateQualityStale() {
        if (sellIn < 0 && quality > 0) {
            quality = quality - 1;
        }
    }
}
